package com.example.pvshow.activity

import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.example.content.R
import com.example.content.activity.LoginActivity
import com.example.content.activity.MainActivity
import com.example.content.viewmodule.login.TokenStore
import com.gyf.immersionbar.ImmersionBar

class SplashActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_splash)
        initView()

    }

    private fun initView() {
        window.decorView.postDelayed({
            if (TokenStore.token.isBlank()) {
                this.startActivity(Intent(this@SplashActivity, LoginActivity::class.java))
            } else {
                this.startActivity(Intent(this@SplashActivity, MainActivity::class.java))
            }
            this.finish()
        }, 500)
   }
}